package com.huawei;

import java.util.*;

/**
 * Created by Z-hong on 2024/7/24.
 */

public class HJ90 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        String[] split = str.split("\\.");
        if (split.length != 4) {
            System.out.println("NO");
            return;
        }
        boolean flag = true;
        for (int i = 0; i < split.length; i++) {
            //正则表达式判断split[i]是否为数字并且有数字时 不为0开头 可以为单0
            if (!split[i].matches("[1-9][0-9]*") && !split[i].matches("0")) {
                flag = false;
                break;
            }

            int num = Integer.parseInt(split[i]);
            if (num < 0 || num > 255) {
                flag = false;
                break;
            }
        }
        if (flag) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}
